package com.yazi.mxz.behavior.dao.impl;


import org.hibernate.Criteria;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.myframework.smhj.hibernate.Searching;
import com.myframework.smhj.hibernate.Page;
import com.myframework.smhj.hibernate.dao.BasicDao;
import com.yazi.mxz.behavior.dao.CategoryDao;
import com.yazi.mxz.behavior.entity.beans.Category;

@Repository("categoryDao")
public class CategoryDaoImpl extends BasicDao<Category> implements CategoryDao {

	
	public CategoryDaoImpl() {
		super(Category.class);
		
	}

	@Override
	public Criteria getExample(Category category, String searchWord) {
		Criteria c = createCriteria(Category.class);
		Example example = Example.create(category);
		c.add(example);
		return c;
	}


	@Override
	public Page<Category> listByGtUpdateTime(long updateTime, Searching si) {
		Criteria c = createCriteria(Category.class);
		c.add(Restrictions.gt("updateTime", updateTime));
		return list(c, si);
	}

}
